/**
 */
package Alloy.impl;

import Alloy.AlloyPackage;
import Alloy.ObtainsExpression;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Obtains Expression</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Alloy.impl.ObtainsExpressionImpl#isObtains <em>Obtains</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ObtainsExpressionImpl extends MinimalEObjectImpl.Container implements ObtainsExpression {
	/**
	 * The default value of the '{@link #isObtains() <em>Obtains</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isObtains()
	 * @generated
	 * @ordered
	 */
	protected static final boolean OBTAINS_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isObtains() <em>Obtains</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isObtains()
	 * @generated
	 * @ordered
	 */
	protected boolean obtains = OBTAINS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ObtainsExpressionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AlloyPackage.Literals.OBTAINS_EXPRESSION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isObtains() {
		return obtains;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setObtains(boolean newObtains) {
		boolean oldObtains = obtains;
		obtains = newObtains;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AlloyPackage.OBTAINS_EXPRESSION__OBTAINS, oldObtains, obtains));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case AlloyPackage.OBTAINS_EXPRESSION__OBTAINS:
				return isObtains();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case AlloyPackage.OBTAINS_EXPRESSION__OBTAINS:
				setObtains((Boolean)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case AlloyPackage.OBTAINS_EXPRESSION__OBTAINS:
				setObtains(OBTAINS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case AlloyPackage.OBTAINS_EXPRESSION__OBTAINS:
				return obtains != OBTAINS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (obtains: ");
		result.append(obtains);
		result.append(')');
		return result.toString();
	}

} //ObtainsExpressionImpl
